export const mutations = {
  //传递参数到state里面

  //得到课程列表操作
  get_course_list(state, courses) {
    state.courses = courses;
  },
  search_courses(state,courses){
    state.searchCourses = courses;
  },
  classify_course(state,courses){
    state.ClassifyCourses = courses;
  },
  set_keyword(state,keyword){
    state.keyword = keyword;
  },
  set_message(state,message){
    state.message = message;
  },
  get_banners(state, banners) {
    state.banners = banners;
  },
  get_course_info(state, course) {
    state.course = course;
  },
  get_course_classify(state, classifys){
    state.classifys = classifys;
  },
  get_course_catalog(state, catalog) {
    state.catalog = catalog;

    if( state.videosource.src == '' ){
      let history = state.course.history;
      catalog.forEach(function (ct) {
        if (ct.mlid == history.pmlid) {
          ct.sub.forEach(function (cts) {
            if (cts.mlid == history.mlid) {
              cts.content.forEach(function (ctsc) {
                if (ctsc.nrid == history.nrid) {
                  let sources = {
                    type: "video/mp4",
                    src: "http://testqn.u-sooc.com/20161027_58118e901a555135420709_0.mp4"
                  };
                  state.videosource = sources;
                }
              })
            }
          })
        }
      });
    }
  },
  add_course(state, course) {
    state.course = course;
  },
  //展示加载数据
  show_load(state,status){
    state.isLoad = status;
  }
}

export default mutations